package com.lemei.cn.filepath;

import android.content.res.AssetManager;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;


public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        //路径指向data/data/包名/file文件夹下，这样不会被轻易清除
        File file = new File(getFilesDir(), "abc.db");
        //获取文件的绝对路径
        SQLiteDatabase.openDatabase(file.getAbsolutePath())

        //从assets中获取数据

        AssetManager anAssert = getAssets();
        try {
            InputStream open = anAssert.open("abc.db");
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
